chore: change execute progressive rollout condition #784
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #712
Things done
This pull request introduces several changes to the
pkg/autoops/api/
package in order to improve the handling of progressive rollout status, add checks for stop status, and refactor the code to simplify the logic and improve readability. The changes also include updates to the test suite to reflect these modifications.Error Handling and Status Checks:
pkg/autoops/api/error.go
: Added a new statusstatusProgressiveRolloutAlreadyStopped
to handle cases where a progressive rollout is already stopped.pkg/autoops/api/progressive_rollout.go
: Added a new methodcheckStopStatus
to check if the progressive rollout is already stopped. This method is used inExecuteProgressiveRollout
.pkg/autoops/domain/progressive_rollout.go
: Added a new methodIsStopped
to theProgressiveRollout
struct to check if the progressive rollout is stopped.Code Refactoring and Simplification:
pkg/autoops/api/progressive_rollout.go
: Refactored theExecuteProgressiveRollout
method to useftstorage.NewFeatureStorage
andftStorage.GetFeature
instead of the previous approach. Also added checks for stop status and logic to enable the feature flag if it is disabled and it is the first rollout execution. [1] [2] [3]pkg/autoops/api/progressive_rollout_operation.go
: Refactored theExecuteProgressiveRolloutOperation
and related methods to useftdomain.Feature
instead offeatureclient.Client
. Also simplified the logic to update the rollout strategy. [1] [2]Test Suite Updates:
test/e2e/autoops/progressive_rollout_test.go
: Updated the tests to create disabled features and check if the feature is enabled during the progressive rollout. (F6f93751L15R15, [1] [2] [3]